package Game;

import java.util.ArrayList;
import java.util.HashMap;

public class Character extends Unit {
	public static final String CHARACTER_HUMAN = "0000";
	public static final String CHARACTER_ELF = "0001";
	public static final String CHARACTER_DWARF = "0002";
	public static final String CHARACTER_ORC = "0003";
	public static final String CHARACTER_GOBLIN = "0004";
	
	public static final int DEFAULT_INVENTORY_CAPACITY = 5;
	
	int XP = 0;
	
	HashMap<Integer, Integer> weaponEfficiency = new HashMap<>();
	
	int capacity = DEFAULT_INVENTORY_CAPACITY;
	ArrayList<Item> inventory = new ArrayList<>();
	
	Weapon leftWeapon;
	Weapon rightWeapon;
	Armor armor;
	
	public Character(String _ID) {
		super(_ID);
	}
	
	/**
	 * Checks whether Character's inventory is full.
	 * @return True if Character's inventory is full, false otherwise.
	 */
	public boolean isInventoryFull() {
		return (inventory.size() == capacity);
	}
	
	/**
	 * Checks whether Character is equipping any weapon.
	 * @return True if Character is equipping weapon, false otherwise.
	 */
	public boolean isEquipWeapon() {
		return leftWeapon != null;
	}
	
	/**
	 * Checks whether Character is equipping a one-handed weapon.
	 * @return True if Character is equipping a one-handed weapon, false otherwise.
	 */
	public boolean isEquip1HWeapon() {
		return isEquipWeapon() && leftWeapon.is1H();
	}
	
	/**
	 * Checks whether Character is equipping a two-handed weapon.
	 * @return True if Character is equipping a two-handed weapon, false otherwise.
	 */
	public boolean isEquip2HWeapon() {
		return isEquipWeapon() && leftWeapon.is2H();
	}
	
	/**
	 * Checks whether Character is equipping a ranged weapon.
	 * @return True if Character is equipping a ranged weapon, false otherwise.
	 */
	public boolean isEquipRangedWeapon() {
		return isEquipWeapon() && leftWeapon.isRanged();
	}
	
	/**
	 * Checks whether Character is equipping dual weapons.
	 * @return True if Character is equipping dual weapons, false otherwise.
	 */
	public boolean isEquipDualWeapon() {
		return isEquipWeapon() && (rightWeapon != null);
	}
	
	/**
	 * Checks whether Character is equipping a sword.
	 * @return True if Character is equipping a sword, false otherwise.
	 */
	public boolean isEquipSword() {
		return isEquipWeapon() && leftWeapon.isSword();
	}
	
	public static void main(String[] args) {
		Character character = new Character(CHARACTER_HUMAN);
		
		Class cls = new Class(Class.CLASS_HUMAN_KNIGHT);
		cls.onChangeToClass(character);
		System.out.println(character);
	}
}
